package last.code.maxsonarray;

import java.util.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Scanner;

public class Double {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] array = scanner.next().split(",");
        List<BigDecimal> list = new ArrayList<>();
        for (int i = 0; i < array.length; i++) {
            list.add(new BigDecimal(array[i]));
        }

        List<BigDecimal> result = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            BigDecimal max = list.get(i);
            BigDecimal sum = new BigDecimal("1");
            for (int j = 0; j < list.size(); j++) {
                sum = sum.multiply(list.get(j));
                if (max.compareTo(sum) < 0) {
                    max = sum;
                }
            }
            result.add(max);
        }

        BigDecimal max = result.get(0);
        for (BigDecimal item : result) {
            if (max.compareTo(item) < 0) {
                max = item;
            }
        }
        System.out.println(max);
    }
}
